/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package API;

import javax.microedition.lcdui.Graphics;

/**
 *
 * @author mrbao
 */
public class Button extends Item {

    public Button(String text, int y, int width) {
        this.text = text;
        this.y = y;
        this.width = width;
    }

    public void Paint(Graphics g) {
        Gradient.DrawGradientBox(g, (width - font.stringWidth(text) - 10) / 2, y, font.stringWidth(text) + 10, font.getHeight() + 10);
        g.fillRect((width - font.stringWidth(text) - 10) / 2, y + (font.getHeight() + 10) / 2, font.stringWidth(text) + 10, (font.getHeight() + 10) / 2);
        g.drawRoundRect((width - font.stringWidth(text) - 14) / 2, y - 1, font.stringWidth(text) + 13, font.getHeight() + 12, cornerRadius, cornerRadius);
        g.setColor(colorText);
        g.drawString(text, (width - font.stringWidth(text)) / 2, y + 5, 0);
    }
}
